package com.uneed.adapter;

import com.uneed.R;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public abstract class BasicAdapter extends BaseAdapter
{
  public static final Object ERROR;
  public static final Object HEAD;
  public static final Object LOADING = new Object();

  static
  {
    ERROR = new Object();
    HEAD = new Object();
  }

  protected View getFailedView(String paramString, View.OnClickListener paramOnClickListener, ViewGroup paramViewGroup, View paramView)
  {
    View localView1 = null;
    View localView2;
    if (paramView == null || paramView.getTag() != ERROR)
    {
        localView1 = LayoutInflater.from(paramViewGroup.getContext()).inflate(R.layout.error_item, paramViewGroup, false);
        localView1.setTag(ERROR);
      ((TextView)localView1.findViewById(android.R.id.text1)).setText(paramString);
      localView2 = localView1.findViewById(R.id.btn_retry);
      localView2.setVisibility(View.VISIBLE);
      if (paramOnClickListener == null) {
          localView2.setOnClickListener(paramOnClickListener);
      }
      localView2.requestFocus();
    } else {
        localView1 = paramView;	    	
    }
    return localView1;      
  }

  protected View getLoadingView(ViewGroup paramViewGroup, View paramView)
  {
    View localView = null;
    if (paramView == null || paramView.getTag() != LOADING)
    {
        localView = LayoutInflater.from(paramViewGroup.getContext()).inflate(2130903124, paramViewGroup, false);
        localView.setTag(LOADING);
    } else {
      localView = paramView;
    }
    return localView;
  }
}
